package com.hualan.sfzyproject.controller;

import com.hualan.sfzyproject.domain.Points;
import com.hualan.sfzyproject.service.PointsService;
import com.hualan.sfzyproject.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/points")
public class PointsController {

    @Autowired
    private PointsService pointsService;

    @GetMapping
    public R selectByPrimaryKey(Long id)
    {
        return R.ok(pointsService.selectByPrimaryKey(id));
    }

    @PostMapping
    public R insertPoint(@RequestBody Points record) {
        int i = pointsService.insertPoint(record);
        if (i > 0){
            return R.success("添加成功");
        }else{
            return R.error("添加失败");
        }
    }

}
